Carbon


NewPalette

Header: Palettes.h Carbon status: Supported

Allocates a new palette from colors in the color table.

PaletteHandle NewPalette (
    SInt16 entries, 
    CTabHandle srcColors, 
    SInt16 srcUsage, 
    SInt16 srcTolerance
);
Parameter descriptions
entries

The number of ColorInfo structures to be created in the new palette.

srcColors

A handle to the color table from which the colors are to be obtained. If no color table is provided (srcColors = NULL), then all colors in the palette are set to black (red, green, and blue equal to $0000).

srcUsage

The usage value to be assigned each ColorInfo structure in the palette.

srcTolerance

The tolerance value to be assigned each ColorInfo structure in the palette.

function result

A handle to the new palette.

DISCUSSION

The NewPalette function fills the palette with as many RGB values from the color table as it has or can fit.

To attach a palette to a window after creating it, use the SetPalette function. To change the entries in a palette after creating it, use the SetEntryColor and SetEntryUsage functions.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)